#define _CRT_SECURE_NO_WARNINGS 1

#include<stdio.h>

//int main()
//{
//	const char* p = "asdas";
//	printf("%d", sizeof(p));
//	return 0;
//}
#include <stdio.h>
int main()
{
    int x, y;
    scanf("%2d%*4s%2d", &x, &y);
    printf("%d", y - x);
    return 0;
}